﻿using System;
using System.Collections.Generic;
using System.Text;
using Newtonsoft.Json;
using Wuliu.SDK.Core.Client;
using Wuliu.SDK.Core.Model;

namespace Wuliu.SDK.Example
{
    public class DeBangExamples
    {
        public static void RunAll()
        {            
            新标准轨迹查询();
            //标准轨迹订阅();
        }

      

        private static void 新标准轨迹查询()
        {
            var client = new DeBangClient(Config.debangAppkey,Config.debangCompanyCode);
            NewTraceQuery request = new NewTraceQuery();
            request.mailNo = "6291370455";
            var result = client.GetTraceQuery(request).Result;

            foreach (var item in result.responseParam.trace_list)
            {
                Console.WriteLine(JsonConvert.SerializeObject(item));
            }
        }

        private static void 标准轨迹订阅()
        {
            var client = new DeBangClient(Config.debangAppkey, Config.debangCompanyCode);

            StandTraceSubscribe request = new StandTraceSubscribe();
            request.tracking_number = "6291370455";
            request.order_number = request.tracking_number;
           
            var result = client.GetStandTraceSubscribe(request).Result;
            Console.WriteLine("******************************");
            Console.WriteLine(JsonConvert.SerializeObject(result));
        }
    }
}
